﻿using System;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ZeroBug.EasyFlow.Core;

namespace EasyFlow
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public ICommand StepInfoDropCommand
        {
            get { return (ICommand)GetValue(StepInfoDropCommandProperty); }
            set { SetValue(StepInfoDropCommandProperty, value); }
        }

        // Using a DependencyProperty as the backing store for StepInfoDropCommand.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty StepInfoDropCommandProperty =
            DependencyProperty.Register("StepInfoDropCommand", typeof(ICommand), typeof(MainWindow), new PropertyMetadata(null));


        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = new MainWindowViewModel();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            
            
        }

        private void GetAppStartDpi(out double dpixRatio, out double dpiyRatio)
        {
            var dpiXProperty = typeof(SystemParameters).GetProperty("DpiX", BindingFlags.NonPublic | BindingFlags.Static);
            var dpiYProperty = typeof(SystemParameters).GetProperty("Dpi", BindingFlags.NonPublic | BindingFlags.Static);
            var dpiX = (int)dpiXProperty.GetValue(null, null);
            var dpiY = (int)dpiYProperty.GetValue(null, null);
            dpixRatio = dpiX*1.0 / 96;
            dpiyRatio = dpiY * 1.0 / 96;
        }

        private void flowTree_KeyDown(object sender, KeyEventArgs e)
        {

        }

        private void flowTreeItem_DragOver(object sender, DragEventArgs e)
        {

        }

        private void flowTreeItem_Drop(object sender, DragEventArgs e)
        {
            if (StepInfoDropCommand != null)
                StepInfoDropCommand.Execute(e.Data.GetData(DataFormats.Serializable));
        }
    }
}